package org.jeecg.api.controller.user;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.api.annotation.ApiNeedLogin;
import org.jeecg.api.dto.req.user.WithdrawApplyDto;
import org.jeecg.api.utils.MiniappSpringContextUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.util.SignDO;
import org.jeecg.modules.recruit.withdraw.service.IMmAppUserWithdrawService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 微信小程序用户接口
 */
@RestController
@RequestMapping("/app/withdraw/")
@Api(tags = "提现相关接口")
@Slf4j
@ApiNeedLogin
public class WxMiniappWithdrawController {

    @Autowired
    private IMmAppUserWithdrawService mmAppUserWithdrawService;

    @PostMapping("提现申请接口")
    @ApiOperation(value = "提现申请")
    public Result<Boolean> withdrawApply(@RequestBody WithdrawApplyDto apply) {
        SignDO signDO = MiniappSpringContextUtils.getSignDO();
        apply.setUserId(signDO.getUserId());
        mmAppUserWithdrawService.withdrawApply(apply);
        return Result.OK();
    }
}